<div class="container">
	<!---top-row--->
	<div class="top-row">
    <?php
        // Get category
        $get_categories = get_by_sql('SELECT * FROM  tbl_category WHERE status = 1 ORDER BY id DESC LIMIT 3', '');
        if(sizeof($get_categories) > 0 ) {
            foreach($get_categories AS $data_category) :
            // Count product
            $num_products = countOf('tbl_product','cat_id ='. $data_category['id'] );
    ?>
    <div class="col-xs-4">
        <div class="top-row-col1 text-center">
            <h2><?php echo $data_category['name']?></h2>
            <img class="r-img text-center" src="admin/upload/categories/<?php echo $data_category['image']?>" width="189" height="189" title="name" alt="starndard" />
            <span><img src="admin/upload/categories/<?php echo $data_category['image']?>" alt="<?php echo $data_category['name']?>" title="<?php echo $data_category['name']?>" /></span>
            <h4>TOTAL</h4>
            <label><?php echo $num_products?> PRODUCTS</label>
            <a class="r-list-w" href="#"><img src="images/list-icon.png" title="list" /></a>
        </div>
    </div>
    <?php 
            endforeach;
        }
    ?>
    
    <vdi class="clearfix"> </div>
    
</div>
<!---top-row--->
<div class="container"> 
    <!----speical-products----> 
    <div class="special-products">
        <div class="s-products-head">
            <div class="s-products-head-left">
                <h3>All <span>PRODUCTS</span></h3>
            </div>
            <div class="s-products-head-right">
                <a href="products.html"><span> </span>view all products</a>
            </div>
            <div class="clearfix"> </div>
        </div>
        <!----special-products-grids---->
        <div class="special-products-grids">
            <?php
                // Get products
                $get_products = get_by_sql('SELECT * FROM  tbl_product WHERE status = 1 ORDER BY id DESC LIMIT 12 ', '');
                if(sizeof($get_products) > 0 ) {
                    foreach($get_products AS $data_product) :
            ?>
            <div class="col-md-3 special-products-grid text-center">
                <!--<a class="brand-name" href="?page_main=single-page&action=single-page"><img src="images/b1.jpg" width="250" height="200" title="name" alt="starndard" /></a>-->
                <a class="product-here" href="?page_main=single-page&action=single-page&id=<?php echo $data_product['id']?>"><img src="admin/upload/products/<?php echo $data_product['image']?>" width="250" height="200" alt="<?php echo $data_product['name']?>" title="<?php echo $data_product['name']?>" /></a>
                <h4><a href="?page_main=single-page&action=single-page&id=<?php echo $data_product['id']?>"><?php echo substr($data_product['name'],0,17)?></a></h4>
                <a class="product-btn" href="?page_main=single-page&action=single-page&id=<?php echo $data_product['id']?>"><span><?php echo $data_product['price']?>$</span><small>GET NOW</small><label> </label></a>
            </div>
            <?php 
                    endforeach;
                }
            ?> 
            
            <div class="clearfix"> </div>
        </div>
        <!---//special-products-grids---->
    </div>
    <!---//speical-products---->
</div>